package org.springblade.modules.repair.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.repair.entity.MaintainPlanContentUser;
import org.springblade.modules.repair.enums.EmerProcTypeEnum;
import org.springblade.modules.repair.enums.MaintainPlanContentEnum;

import java.util.Date;
import java.util.List;

/**
 * @Date 11:15 2022/4/28
 * @Description {
 *   维修列表分页
 * }
 * @Author lsay
 **/
@Data
public class MalFunctionPlanPageVO {

	@JsonSerialize(using = ToStringSerializer.class)
	private Long planId;

	@JsonSerialize(using = ToStringSerializer.class)
	private Long elevatorId;

	@JsonSerialize(using = ToStringSerializer.class)
	private Long buildingId;

	private Integer typeStatus;

	/**
	 * 任务类型名称
	 */
	private String typeStatusName;

	private Integer status;

	private String mfDesc;

	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private Date createTime;

	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private Date updateTime;

	private String problemItem;
	private String problemOtherDesc;

	/**
	 * 电梯状态： 1-正常,2-停梯
	 */
	private Integer elevatorStop;

	/**
	 * 项目名称
	 */
	private String buildingName;

	/**
	 * 电梯位置
	 */
	private String elevatorAddress;

	/**
	 * 故障现象
	 */
	private List<String> problemItemNames;

	/**
	 * 部件名称集合
	 */
	private String partsName;

	/**
	 * 层站id
	 */
	private String floorStandIds;

	/**
	 * 层站名称
	 */
	private String floorStandNames;

	/**
	 * 部件数量
	 */
	private Integer num;

	/**
	 * 关联人员
	 */
	private List<MaintainPlanContentUser> planContentUserVos;

	/**
	 * 电梯停梯状态
	 */
	private Integer isStop;

	/**
	 * 紧急程度
	 */
	private Integer emerProcType;

	/**
	 * 紧急程度描述
	 */
	private String emerProcTypeName;

	@ApiModelProperty("1:转派工单")
	private Integer giveStatus;

	@ApiModelProperty("评分状态 0-未评分，1-已评分")
	private Integer scoreStatus;

	@ApiModelProperty("评分类型1:有效订单，2：无效工单3：无法判断")
	private Integer scoreType;


	public void setPartsName(String partsName) {
		if(Func.isNotEmpty(partsName)){
			this.partsName = partsName.replace("&amp;&amp;",">");
		}
	}

	public void setFloorStandNames(String floorStandNames) {
		if(Func.isNotEmpty(floorStandNames)){
			this.floorStandNames = floorStandNames.replace("&amp;&amp;",">");
		}
	}

	public void setEmerProcType(Integer emerProcType) {
		if(Func.isNotEmpty(emerProcType)){
			this.emerProcTypeName = EmerProcTypeEnum.getName(emerProcType);
		}
		this.emerProcType = emerProcType;
	}

	public void setTypeStatus(Integer typeStatus) {
		this.typeStatusName = MaintainPlanContentEnum.getName(typeStatus);
		this.typeStatus = typeStatus;
	}


}
